package org.alive.ee.app.repository;

import java.util.List;

import javax.persistence.Query;

import org.alive.ee.app.entity.User;
import org.springframework.stereotype.Repository;

@Repository
public class UserDAO extends BaseDAO {

	@SuppressWarnings("unchecked")
	public User findUserByLoginName(String loginName) {
		Query q = em.createQuery(" from User where loginName = ? ");
		q.setParameter(1, loginName);
		List<User> uu = q.getResultList();
		if (uu != null && uu.size() > 0) {
			return uu.get(0);
		}
		return null;
	}
}
